﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UtilZ.Dotnet.Ex.Communication.Net.Web
{
    /// <summary>
    /// ping消息
    /// </summary>
    public class WebSocketPingMessage : WebSocketMessageAbs
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public WebSocketPingMessage()
            : base(WebSocketMessageTypes.Ping)
        {

        }


        /// <summary>
        /// 获取操作码
        /// </summary>
        /// <returns>操作码</returns>
        protected override byte PrimitiveGetOpcode()
        {
            return HttpOpcodes.PING;
        }


        /// <summary>
        /// 获取本次发送帧的数据(返回true表示还有数据需要发送,返回false表示最后一帧数据)
        /// </summary>
        /// <param name="frameInfo">帧数据</param>
        /// <returns>true表示还有数据需要发送,返回false表示最后一帧数据</returns>
        protected override void GetFrameData(FrameInfo frameInfo)
        {
            frameInfo.FrameData = null;
            frameInfo.FrameIndex = 1;
            frameInfo.FrameCount = 1;
        }
    }
}
